﻿//-----------------------------------------------------------------------------------
// <copyright file="MySession.cs" company="Go Enterprises">
// * copyright: (C) 2018 公司名称 版权所有。
// * version  : 1.0.0.0
// * author   : Mr.King
// * fileName : MySession.cs
// * history  : created by Mr.King 2024-11-26 18:34:56
// </copyright>
//-----------------------------------------------------------------------------------

using System;
using System.Runtime.Serialization;
using XLLCDP.ScalableDataModel.DBMapAttribute;

namespace ImModels.Service.Models.Data
{
    /// <summary>
    /// MySession 我的会话列表
    /// </summary>
    public class MySession
    {
        /// <summary>
        /// 会话ID,全局唯一
        /// 当为系统会话的时候 此会话ID和企业ID一致
        /// </summary>
        public long SessionId { get; set; } = 0;

        /// <summary>
        /// 状态,0正常 1禁用(免打扰之类)
        /// </summary>
        public short States { get; set; } = 0;

        /// <summary>
        /// 是否删除 0未删除 1已删除
        /// </summary>
        public short IsDeleted { get; set; } = 0;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 所属企业ID
        /// </summary>
        public long EnterpriseId { get; set; } = 0;

        /// <summary>
        /// 用户ID
        /// </summary>
        public string BizUserId { get; set; } = "";

        /// <summary>
        /// 好友ID，可能是用户ID，也可以是群ID （根据 IsGroup 判断），0表示未系统会话
        /// </summary>
        public string ToUserId { get; set; } = "";

        /// <summary>
        /// 是否为群组 0用户,1群组 2系统会话
        /// </summary>
        public short IsGroup { get; set; } = 0;

        /// <summary>
        /// 用户名称 群名称，真实名称需关联
        /// </summary>
        public string FullName { get; set; } = "";

        /// <summary>
        /// 备注,每个人都可以备注自己的名称
        /// </summary>
        public string NickName { get; set; } = "";

        /// <summary>
        /// 会话头像 一般为用户或多人群的头像
        /// 如果是群组 则头像是 逗号连接的多人,前端显示的时候 需要按小头像拼凑显示
        /// </summary>
        public string HeadImg { get; set; } = "";

        /// <summary>
        /// 最近一条消息
        /// </summary>
        public string LastMsg { get; set; } = "";

        /// <summary>
        /// 最近一条消息时间
        /// </summary>
        public string LastMsgTime { get; set; } = "";

        /// <summary>
        /// 会话标签 [外部,售后,投诉],可显示到会话右上角
        /// </summary>
        public string Flags { get; set; } = "";

        /// <summary>
        /// 扩展信息,可Json存储
        /// </summary>
        public string ExJson { get; set; } = "";

        /// <summary>
        /// 入群时间,在查询消息时 作为条件查询
        /// </summary>
        public string JoinGroupTime { get; set; } = "";

        /// <summary>
        /// 当前会话 我的消息 未读总数
        /// </summary>
        public int UnReadCnt { get; set; } = 0;

        /// <summary>
        /// 是否置顶 0未置顶 1置顶
        /// </summary>
        public short IsTop { get; set; } = 0;

        /// <summary>
        /// 如果会话是一个群 则关联得到群用户列表 方便前端缓存
        /// </summary>
        [XLDbColumn(IsIgnore = true)]
        public List<ImGroupUser>? GroupUser { get; set; }

        /*BC47A26EB9A59406057DDDD62D0898F4*/
    }

    public class SessionFroupUser
    {
        /// <summary>
        /// 业务用户ID
        /// </summary>
        public string BizUserId { get; set; } = "";

        /// <summary>
        /// 用户昵称
        /// </summary>
        public string Name { get; set; } = "";

        public string HeadImg { get; set; } = "";
    }
}
